﻿using UnityEngine;
using System.Collections;

public abstract class GameUI : MonoBehaviour
{
    public void SetAlpha(float fAlpha)
    {
        Color MyColor = gameObject.GetComponent<SpriteRenderer>().color;

        gameObject.GetComponent<SpriteRenderer>().color = new Color(MyColor.r, MyColor.g, MyColor.b, fAlpha);
    }

    public void ChangeAlpha(float fDestAlpha)
    {
        Color MyColor = gameObject.GetComponent<SpriteRenderer>().color;

        gameObject.GetComponent<SpriteRenderer>().color = new Color(MyColor.r, MyColor.g, MyColor.b, MyColor.a - fDestAlpha);
    }

    public void SetColor(Color DestColor)
    {
        gameObject.GetComponent<SpriteRenderer>().color = new Color(DestColor.r, DestColor.g, DestColor.b, 
            gameObject.GetComponent<SpriteRenderer>().color.a);
    }
}
